class Route
{
	public uid:string;
	public gameid:string;
	public preview:string;
}
class RouteManager 
{
	private static s_RouteManager:RouteManager;
	public static getInstance():RouteManager
	{
		if(this.s_RouteManager == null)
		{
			this.s_RouteManager = new RouteManager();
		}
		return this.s_RouteManager;
	}
	private m_parameter:string;
	private m_paraArr:Array<string>;
	public m_paraObj:Route;
	public init()
	{
		let address = location.href;
		let num = address.indexOf("?");
		if(num < 0)
		{
			return;
		}
		let parameter = address.substr(num + 1);
		let arr = parameter.split("&");
		this.m_parameter = parameter;
		this.m_paraArr = arr;
		this.m_paraObj = new Route();
		for(let i = 0; i < this.m_paraArr.length; i++)
		{
			let keyNum = arr[i].indexOf("=");
			let key = arr[i].substring(0, keyNum);
			let value = arr[i].substring(keyNum + 1);
			this.m_paraObj[key] = value;
		}
		for(let i = 0; i <  Object.keys(this.m_paraObj).length; i++)
		{
			let key:string = Object.keys(this.m_paraObj)[i];
			console.log("key:" + key + "   value:" + this.m_paraObj[key]);
		}
		//this.m_paraObj.gameid = "B12";
	}

}